import { defineStore } from 'pinia'
import type { IMainState } from '../../types/main'
import { getProjectsListData } from '@/service/main/main'
import { localCache } from '@/utils/cache'
const useMainStore = defineStore('main', {
  state: (): IMainState => ({
    projectsList: [],
    // 首页点击更多时传递的数据
    choiseItem: 0,
    //首页项目展示
    mainProjects: {},
  }),
  actions: {
    getProjectsListAction() {
      this.projectsList = getProjectsListData()
      localCache.setCache('ProjectsListData', this.projectsList)
    }
  },
  persist:true
})

export default useMainStore
